<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAppUpdateInfosTable extends Migration
{
    const TABLE_NAME = 'app_update_infos';
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create(self::TABLE_NAME, function (Blueprint $table) {
            $table->charset = 'utf8';
            $table->collation = 'utf8_general_ci';
            $table->increments('id');
            $table->timestamp('app_update_time')->nullable()->comment('app更新时间');
            $table->string('title')->comment('窗口标题');
            $table->string('version')->comment('版本号');
            $table->string('install_pkg_url')->comment('安装包链接');
            $table->string('app_update_text')->comment('更新文本');
            $table->tinyInteger('status')->comment('更新版本状态');
            $table->timestamps();
        });
        \DB::statement('ALTER TABLE `'. self::TABLE_NAME.'`CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
        \DB::statement('ALTER TABLE `'. self::TABLE_NAME.'`COMMENT="APP版本更新信息表";');
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists(self::TABLE_NAME);
    }
}
